package com.allenkerr.client;

import com.allenkerr.model.Person;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.List;

/**
 * Created by 小柯(Allen Kerr) on 17.6.25 00:05.
 */
@FeignClient(name = "demo03",url = "http://localhost:7900")
public interface PeopleFeignClient {

    /**
     * 请求demo03的服务
     * http://localhost:7900/people
     */
    @GetMapping("/people")
    public String getPeople();

    /**
     * 获取json，并转换为对象
     * http://localhost:7900/people
     */
    @GetMapping("/people")
    public List<Person> getPeopleToPojo();

    /**
     * http://localhost:7900/people/id/1
     */
    @GetMapping("/people/id/{id}")
    public String getPersonById(@PathVariable("id") Integer id);//@PathVariable必须加上value值

    /**
     * http://localhost:7900/people/id/1
     */
    @GetMapping("/people/id/{id}")
    public Person getPersonByIdToPojo(@PathVariable("id") Integer id);//@PathVariable必须加上value值

}
